﻿using System;
using System.Collections.Generic;
//using System.Linq;

using NHibernate.Cfg;
using NHibernate.GuitarStore.DataAccess;
using NHibernate.GuitarStore.Common;
using NHibernate.Linq;
using System.Linq;


namespace NHibernate.GuitarStore.Console
{
    class Program
    {
        static void Main(string[] args)
        {
            try
            {
                NHibernateBase nhb = new NHibernateBase();
                nhb.Initialize("NHibernate.GuitarStore");
                System.Console.WriteLine("Inicializado correctamente");
                IList<Inventory> list1 = NHibernateBase.StatelessSession.CreateQuery("from Inventory").List<Inventory>();
                IList<Inventory> list2 = NHibernateBase.Session.CreateCriteria(typeof(Inventory)).List<Inventory>();

                IQueryable<Inventory> linq = NHibernateBase.Session.Query<Inventory>();
          
                System.Console.ReadLine();
            }
            catch(Exception ex)
            {
                string message = ex.Message;
                if (ex.InnerException != null)
                {
                    message += "InnerException: "+   ex.InnerException.Message;
                }

                System.Console.WriteLine();
                System.Console.WriteLine("Error!!!");
                System.Console.WriteLine(message);
                System.Console.WriteLine();
                System.Console.ReadLine();
            }
        }
    }
}
